package com.chenshang.config;

import java.util.Map;

import com.chenshang.util.FileReaderUtil;
import com.google.gson.Gson;

public class ConfigLoader {
	static ConfigMap configMap;
	private static ConfigLoader configLoader = new ConfigLoader();
	private static Map<String, InvokeInfo> invokeInfos;

	private ConfigLoader() {
	}

	static {
		Gson gson = new Gson();
		String json = FileReaderUtil.readFileToString("/home/chenshang/workspace/test-openapi/src/main/resource/config/requestMap.json");
		configMap = gson.fromJson(json, ConfigMap.class);
		invokeInfos = configMap.getInvokeInfos();
	}

	public static ConfigLoader getInstance() {
		return configLoader;
	}

	public static ConfigMap getConfigMap() {
		return configMap;
	}

	public static Map<String, InvokeInfo> getInvokeInfos() {
		return invokeInfos;
	}

}
